/*
 * Copyright (C) Michael Martin & Antonio Carrozzini (TBJD)
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */

package org.tbjd.client.interfaces;

import org.tbjd.client.exceptions.TBJDException;
/**
 * <p>
 * A Decisionmaker has to decide whether it handles a received object and/or to delegate it to another Decisionmaker
 * </p>
 * <p>
 * Every method can throw a {@link org.tbjd.client.exceptions.TBJDException TBJDException} if one of them isn't possible/permitted
 * </p>
 * 
 * @author Michael Martin
 * @author Antonio Carrozzini
 * @version 1.0
 * 
 */
public interface Decisionmaker {

	/**
	 * <p>
	 * Decides either to handle and/or delegate the given object
	 * </p>
	 * 
	 * @param action
	 *            the object containing the data to be either handled or to delegated
	 */
	void decide(Object action) throws TBJDException;

	/**
	 * <p>
	 * Handles the given object
	 * </p>
	 * 
	 * @param action
	 *            the object containing the data to be either handled or to delegated
	 */
	void handle(Object action) throws TBJDException;

	/**
	 * <p>
	 * Delegates the given object
	 * </p>
	 * <p>
	 * This method usually tries to find an upper {@link org.tbjd.client.interfaces.Decisionmaker Decisionmaker} to call its decide() method
	 * </p>
	 * 
	 * @param action
	 *            the object containing the data to be either handled or to delegated
	 */
	void delegate(Object action) throws TBJDException;

}
